/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 10 - 15
 * Time: 9:35
 */
//牛客 井字棋
public class Solution8 {
    public boolean checkWon(int[][] board) {
        int N = board.length;
        int sum = 0, i = 0, j = 0;
        for (i = 0; i < N; i++) {
            sum = 0;
            for (j = 0; j < N; j++) {
                sum += board[i][j];
            }
            if(sum == N) {//重点
                return true;
            }
        }

        for (i = 0; i < N; i++) {
            sum = 0;
            for (j = 0; j < N; j++) {
                sum += board[j][i];//重点
            }
            if(sum == N) {
                return true;
            }
        }

        sum = 0;
        for (i = 0; i < N; i++) {
            sum += board[i][i];
            if(sum == N) {
                return true;
            }
        }

        sum = 0;
        for (i = 0; i < N; i++) {
            sum += board[i][N - 1 - i];//重点
            if(sum == N) {
                return true;
            }
        }
        return false;
    }
}
